package test_array

import "fmt"

func Do() {
	fmt.Println("数组测试")
	numArr := [5]int{1, 3, 4, 5, 6}
	for i, v := range numArr {
		fmt.Println("数组", i, v)
	}
	fmt.Println("二维数组测试")
	num2Arr := [][]int{}
	row1 := []int{1, 2, 3}
	num2Arr = append(num2Arr, row1)

	slice1 := numArr[0:3]
	for i, v := range slice1 {
		fmt.Println("切片", i, v)
	}

	//数组传递，重置数组
	resetArr(numArr[:], 5)
	for i, v := range numArr {
		fmt.Println("重置后数据", i, v)
	}
}

func resetArr(arr []int, size int) {
	for i := 0; i < size; i++ {
		fmt.Println(arr[i])
		arr[i] = 0
	}
}
